﻿using Himp.Base;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Volo.Abp.Data;
using Volo.Abp.Domain.Entities.Auditing;
using Volo.Abp.MultiTenancy;

namespace Himp.Outpatient
{
    /// <summary>
    /// 门诊排班计划
    /// </summary>
    public class OtpSchdPlan : AuditedAggregateRoot<Guid>, IMultiTenant
    {
        /// <summary>
        /// 门诊排班类别
        /// </summary>
        public Guid OtpSchdTypeId { get; set; }

        /// <summary>
        /// 门诊排班类别
        /// </summary>
        public OtpSchdType OtpSchdType { get; set; }

        /// <summary>
        /// 门诊挂号类别
        /// </summary>
        public Guid OtpRgstTypeId { get; set; }

        #region 迁移到扩展

        ///// <summary>
        ///// 门诊挂号类别编码
        ///// </summary>
        //public string OtpRgstTypeCodg { get; set; }

        ///// <summary>
        ///// 门诊挂号类别名称
        ///// </summary>
        //public string OtpRgstTypeName { get; set; }

        #endregion

        /// <summary>
        /// 科室编码
        /// </summary>
        public string DeptCodg { get; set; }

        /// <summary>
        /// 科室名称
        /// </summary>
        public string DeptName { get; set; }

        /// <summary>
        /// 医师编码
        /// </summary>
        public string? DrCodg { get; set; }

        /// <summary>
        /// 医师姓名
        /// </summary>
        public string? DrName { get; set; }

        /// <summary>
        /// 医师职称代码
        /// </summary>
        public string? DrProfttlCode { get; set; }

        /// <summary>
        /// 医师职称名称
        /// </summary>
        public string? DrProfttlName { get; set; }

        /// <summary>
        /// 开始日期
        /// </summary>
        public DateTime Begndt { get; set; }

        /// <summary>
        /// 截止日期
        /// </summary>
        public DateTime? Enddt { get; set; }

        /// <summary>
        /// 复诊标识
        /// </summary>
        public bool FollupFlag { get; set; }

        /// <summary>
        /// 建档标识
        /// </summary>
        public bool MedrecFlag { get; set; }

        /// <summary>
        /// 签到标识
        /// </summary>
        public bool SignFlag { get; set; }

        /// <summary>
        /// 分诊标识
        /// </summary>
        public bool TrgFlag { get; set; }

        /// <summary>
        /// 最后执行时间
        /// </summary>
        public DateTime? LastExeTime { get; set; }

        /// <summary>
        /// 有效标识
        /// </summary>
        public bool ValiFlag { get; set; }

        /// <summary>
        /// 时段
        /// </summary>
        public List<OtpSchdPeriod> OtpSchdPeriods { get; set; }

        /// <summary>
        /// 
        /// </summary>
        public Guid? TenantId { get; set; }
    }

    public static class OtpSchdPlanExtensions
    {
        private const string OtpRgstTypeName = "OtpRgstTypeName";

        public static void SetOtpRgstType(this OtpSchdPlan item, string otpRgstTypeName)
        {
            item.SetProperty(OtpRgstTypeName, otpRgstTypeName);
        }

        public static string GetOtpRgstType(this OtpSchdPlan item)
        {
            return item.Property<string>(OtpRgstTypeName);
        }
    }
}
